#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.1.6 (beta)
 Author:         ERRO

 Script Function:
	Dynamically creates buttons. strategix

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui_width = 600
$gui_height = 600

$gui = GUICreate("SX", $gui_width, $gui_height)

Global $grid_size = 9, $game_buttons[$grid_size^2 + 1]
Local $row = 1, $border = 20, $between_hori = 60, $between_vert = 60, $button_count = 0, $button_width = 50, $button_height = 50

$game_buttons[0] = $grid_size^2

For $i = 1 To $game_buttons[0]
	$row = Ceiling($i / $grid_size)
	$button_count = ($i - ($grid_size * $row)) + ($grid_size - 1)
	$game_buttons[$i] = GUICtrlCreateButton($i, $border + ($between_vert * $button_count), $border + ($row * $between_vert) - $between_vert, $button_width, $button_height)
Next

GUISetState()

Sleep(5000)
Exit